<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>INSPINIA | Dashboard</title>
        <link href="/tpshop/Public/admin/css/bootstrap.min.css" rel="stylesheet">
    <link href="/tpshop/Public/admin/font-awesome/css/font-awesome.css" rel="stylesheet">
    <link href="/tpshop/Public/admin/font-awesome/css/font-awesome.min.css" rel="stylesheet">
    <link href="/tpshop/Public/admin/css/plugins/toastr/toastr.min.css" rel="stylesheet">
    <link href="/tpshop/Public/admin/js/plugins/gritter/jquery.gritter.css" rel="stylesheet">
    <link href="/tpshop/Public/admin/css/animate.css" rel="stylesheet">
    <link href="/tpshop/Public/admin/css/style.css" rel="stylesheet">
    <link href="/tpshop/Public/admin/css/plugins/summernote/summernote.css" rel="stylesheet">
    <link href="/tpshop/Public/admin/css/plugins/summernote/summernote-bs3.css" rel="stylesheet">
    <!-- FooTable -->
    <link href="/tpshop/Public/admin/css/plugins/footable/footable.core.css" rel="stylesheet">
    <style type="text/css">
        .level1 td{
            background: #eee;
        }
        .level2 td{
            background: #f8f8f8;
            cursor: pointer;
        }
        .level3{
            display: none;
        }
    </style>
        <!-- Mainly scripts -->
    <script src="/tpshop/Public/admin/js/jquery-2.1.1.js"></script>
    <script src="/tpshop/Public/admin/js/bootstrap.min.js"></script>
    <script src="/tpshop/Public/admin/js/plugins/metisMenu/jquery.metisMenu.js"></script>
    <script src="/tpshop/Public/admin/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>


    <!-- Custom and plugin javascript -->
    <script src="/tpshop/Public/admin/js/inspinia.js"></script>
    <script src="/tpshop/Public/admin/js/plugins/pace/pace.min.js"></script>

    <!-- jQuery UI -->
    <script src="/tpshop/Public/admin/js/plugins/jquery-ui/jquery-ui.min.js"></script>
    <!-- FooTable -->
    <script src="/tpshop/Public/admin/js/plugins/footable/footable.all.min.js"></script>
    <!-- SUMMERNOTE -->
    <script src="/tpshop/Public/admin/js/plugins/summernote/summernote.min.js"></script>

    <!-- Page-Level Scripts -->
    <script>
        $(document).ready(function() {

            $('.footable').footable();

            $('.summernote').summernote();

            $('.delete').click(function(){
                if (!confirm("是否删除!")) {
                        return false;
                }
            })

        });
        $("#upload").click(function(){
            $.upload({
                url: "/tpshop/Public/uploads", 
                fileName: 'file', 
                dataType: 'text',
                onSend: function() {
                    return true;
                },
                onComplate: function(data) {
                    $("#img").val(data);
                    $("#preview").html('<img style="height:80px;" src="U('+data+')">');
                }
            });
        })
        function level1change(){
            var id = $('#level1').val();
            $.get("<?php echo U('Admin/Product/getCatalog');?>",{id:id},function(data){
                var str = "";
                for (var i = 0; i < data.length; i++) {
                    str +='<option value="'+data[i].id+'">'+data[i].name+'</option>';
                }
                $('#level2').html(str);
                level2change();
            })
        }
        function level2change(){
            var id = $('#level2').val();
            $.get("<?php echo U('Admin/Product/getCatalog');?>",{id:id},function(data){
                var str = "";
                for (var i = 0; i < data.length; i++) {
                    str +='<option value="'+data[i].id+'">'+data[i].name+'</option>';
                }
                $('#level3').html(str);
            })
        }
        $("#level1").change(level1change);
        $("#level2").change(level2change);
        level1change();
    </script>
</head>
<body>
    <div id="wrapper">
                <nav class="navbar-default navbar-static-side" role="navigation">
            <div class="sidebar-collapse">
                <ul class="nav metismenu" id="side-menu">
                    <li class="nav-header">
                        <div class="dropdown profile-element">
                            <span>
                                <img style="width:50px;" alt="image" class="img-circle" src="/tpshop/Public/img/1.png" />
                            </span>
                            <a data-toggle="dropdown" class="dropdown-toggle" href="#">
                                <span class="clear">
                                    <span class="block m-t-xs">
                                        <strong class="font-bold"><?php echo ($_SESSION['admin_name']); ?></strong>
                                    </span>
                                </span>
                            </a>
                        </div>
                        <div class="logo-element">
                            <img style="width:50px;" alt="image" class="img-circle" src="/tpshop/Public/img/1.png" />
                        </div>
                    </li>
                    <li <?php if(CONTROLLER_NAME == 'Index'): ?>class="active"<?php endif; ?>>
                        <a href="<?php echo U('Admin/Index/index');?>"><i class="fa fa-home"></i> <span class="nav-label">主页</span></a>
                    </li>
                    <li <?php if(CONTROLLER_NAME == 'Order'): ?>class="active"<?php endif; ?>>
                        <a href="<?php echo U('Admin/Order/index');?>"><i class="fa fa-shopping-cart"></i> <span class="nav-label">订单管理</span></a>
                    </li>
                    <li <?php if(CONTROLLER_NAME == 'Catalog'): ?>class="active"<?php endif; ?>>
                        <a href="<?php echo U('Admin/Catalog/index');?>"><i class="fa fa-th-large"></i> <span class="nav-label">分类管理</span></a>
                    </li>
                    <li <?php if(CONTROLLER_NAME == 'Product'): ?>class="active"<?php endif; ?>>
                        <a href="<?php echo U('Admin/Product/index');?>"><i class="fa fa-gift"></i> <span class="nav-label">商品管理</span></a>
                    </li>
                    <li <?php if(CONTROLLER_NAME == 'User'): ?>class="active"<?php endif; ?>>
                        <a href="<?php echo U('Admin/User/index');?>"><i class="fa fa-users"></i> <span class="nav-label">会员管理</span></a>
                    </li>
                    <li <?php if(CONTROLLER_NAME == 'Website'): ?>class="active"<?php endif; ?>>
                        <a href="<?php echo U('Admin/Website/index');?>"><i class="fa fa-wrench"></i> <span class="nav-label">网站设置</span></a>
                    </li>
                </ul>
            </div>
        </nav>
        <div id="page-wrapper" class="gray-bg dashbard-1">
                        <div class="row border-bottom">
                <nav class="navbar navbar-static-top" role="navigation" style="margin-bottom: 0">
                    <div class="navbar-header">
                        <a class="navbar-minimalize minimalize-styl-2 btn btn-primary " href="#"><i class="fa fa-bars"></i> </a>
                    </div>
                    <ul class="nav navbar-top-links navbar-right">
                        <li>
                            <span class="m-r-sm text-muted welcome-message">欢迎来到后台管理.</span>
                        </li>
                        <li>
                            <a href="<?php echo U("Admin/auth/logout");?>">
                                <i class="fa fa-sign-out"></i>退出
                            </a>
                        </li>
                    </ul>
                </nav>
            </div>
            <div class="row">
                <div class="col-lg-12">
                                <div class="row wrapper border-bottom white-bg page-heading">
                <div class="col-md-10">
                    <h2>商品管理</h2>
                    <ol class="breadcrumb">
                        <li>
                            <a href="index">商品管理</a>
                        </li>
                        <li class="active">
                            <strong>发布商品</strong>
                        </li>
                    </ol>
                </div>
            </div>
            <div class="wrapper wrapper-content">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>商品内容</h5>
                        <div class="ibox-tools">
                            <a class="collapse-link">
                                <i class="fa fa-chevron-up"></i>
                            </a>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <form action="<?php echo U('/Admin/Product/do_add');?>" method="POST" class="form-horizontal">
                            <div class="form-group"><label class="col-sm-2 control-label">商品名称</label>

                                <div class="col-sm-10"><input type="text" name="title" class="form-control"></div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">分类</label>

                                <div class="col-sm-3">
                                <select id="level1" class="form-control m-b" name="cata_id">
                                    <option value="0">一级分类</option>
                                    <?php if(is_array($level1)): $i = 0; $__LIST__ = $level1;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$l1): $mod = ($i % 2 );++$i;?><option value="<?php echo ($l1["id"]); ?>"><?php echo ($l1["name"]); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
                                </select>
                                </div>

                                <div class="col-sm-3">
                                <select id="level2" class="form-control m-b" name="cata_id">
                                </select>
                                </div>

                                <div class="col-sm-3">
                                <select id="level3" class="form-control m-b" name="cata_id">
                                </select>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label" for="exampleInputEmail1">图片：</label>
                                <div class=" col-sm-3">
                                    <input type="text" id="img"  class="form-control" name="img"/>
                                </div>
                                    <a id="upload" href="#" class="btn-white btn btn-sm">上传文件</a>
                                <div class="col-sm-7">
                                    <div style="width:100px;" id="preview"></div>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group"><label class="col-sm-2 control-label">是否推荐</label>

                                <div class="col-sm-10">
                                    <div><label> <input type="checkbox" value="">推荐</label></div>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">价格</label>

                                <div class="col-sm-4">
                                    <div class="input-group col-md-6"><span class="input-group-addon">￥</span> <input type="text" name="price" class="form-control"> <span class="input-group-addon">.00</span></div>
                                </div>
                                <label class="col-sm-2 control-label">库存</label>
                                <div class="col-sm-4">
                                    <div class="col-md-6"><input type="text" name="stock" class="form-control"></div>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group"><label class="col-sm-2 control-label">商品简介</label>

                                <div class="col-sm-10"><input type="text" name="desc" class="form-control"></div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group"><label class="col-sm-2 control-label">商品详细描述</label>
                                <div class="col-sm-10">
                                    <div class="ibox float-e-margins">
                                        <div class="ibox-content no-padding">

                                            <div class="summernote">
                                                <h3>Lorem Ipsum is simply</h3>
                                                dummy text of the printing and typesetting industry. <strong>Lorem Ipsum has been the industry's</strong> standard dummy text ever since the 1500s,
                                                when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic
                                                typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with
                                                <br/>
                                                <br/>
                                                <ul>
                                                    <li>Remaining essentially unchanged</li>
                                                    <li>Make a type specimen book</li>
                                                    <li>Unknown printer</li>
                                                </ul>
                                            </div>

                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <div class="col-sm-4 col-sm-offset-2">
                                    <button class="btn btn-white" type="submit">Cancel</button>
                                    <button class="btn btn-primary" type="submit">Save changes</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
                                        <div class="footer">
                        <div>
                            <strong>Copyright</strong> Example Company &copy; 2016-2016
                        </div>
                    </div>
                </div>
            </div>
        </div>
     </div>
</body>
</html>